package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements Operation {
    @Override
    public void work(BookList bookList) {
        System.out.println("查找一本书!");
        System.out.println("请输入书名：");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        Book findBook = bookList.getBookByName(name);
        if (findBook != null) {
            System.out.println("找到这本书了!");
            System.out.println(findBook);
        } else {
            System.out.println("没有这本书!");
        }
    }
}
